module Admin::StoreHelper
  def merchant_column(record)
    link_to record.merchant.username, {:controller => 'admin/merchant', :action => 'show', :id => record.merchant.id}
  end
  
  def passed_form_column(record, input_name)
    select :record, :passed, [["不通过", false],["通过", true]], {}, {:class => "passed-input"}
  end
  
  def certified_form_column(record, input_name)
    select :record, :certified, [["未认证", false],["认证", true]], {}, {:class => "certified-input"}
  end
  
  def upload_logo_column(record)
    image_tag("#{record.upload_logo}", :alt => "Logo")
  end
  
  def upload_store_image_column(record)
    image_tag("#{record.upload_store_image}", :alt => "Store Image")
  end
  
  def upload_license_column(record)
    image_tag("#{record.upload_license}", :alt => "License")
  end
  
  def props_column(record)
    content = ""
    record.props.inject(content) {|content, prop| content = content  << prop.name << '=' << prop.value << ', '}
    content[0, content.length - 2]
  end
  
end
